import {
        request
} from '../request/request.js'

export function getGoddsDetailData(_id) {
        return new Promise((resolve, resject) => {
                request({
                        url: `/shop/goods/detail?id=${ _id }`,
                        method: 'GET',
                }).then(res => {
                        resolve(res)
                })
        })
}

// 加入购物车
export function getShopping(goodsId, number) {
        return new Promise((resolve, resject) => {
                wx.getStorage({
                        key: "token",
                        success(res) {
                                request({
                                        url: `/shopping-cart/add?token=${res.data}&&goodsId=${goodsId}&&number=${number}`,
                                        method: 'POST',
                                }).then(res => {
                                        resolve(res)
                                })
                        }
                })
        })
}